package com.weijianhuawen.wjblog.common.validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @version: java version 8
 * @Author: weijianhuawen
 * @description: 手机号校验器
 * @date: 2025-03-22 20:27
 */
public class PhoneNumberValidator implements ConstraintValidator<PhoneNumber, String> {

    @Override
    public void initialize(PhoneNumber constraintAnnotation) {

    }

    @Override
    public boolean isValid(String phoneNumber, ConstraintValidatorContext constraintValidatorContext) {
        // 校验逻辑
        return phoneNumber != null && phoneNumber.matches("\\d{11}");
    }
}
